import { App, ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import dayjs from 'dayjs';
import React from 'react';

import { components, token } from '@/theme';

import 'dayjs/locale/zh-cn';

dayjs.locale('zh-cn');

interface IProps {
  children: React.ReactNode;
}

const AntdConfigProvider = (props: IProps) => {
  return (
    <ConfigProvider locale={zhCN} theme={{ components, token }}>
      <App>{props.children}</App>
    </ConfigProvider>
  );
};

export { AntdConfigProvider };
